# -*- coding:utf-8 -*-

import os
import datetime

CSRF_ENABLED = True
WTF_CSRF_ENABLED = True
SECRET_KEY = 'dfasfasf35143535'
DEBUG = True
#: cookie 过期时间
REMEMBER_COOKIE_DURATION = datetime.timedelta(seconds=30)
#: session 过期时间
PERMANENT_SESSION_LIFETIME = datetime.timedelta(minutes=5)

#: 本程序根目录
BASEDIR = os.path.abspath(os.path.dirname(__file__))
APP_DIR = os.path.join(BASEDIR, 'golsee')
#: 备份路径
BACKUP_DIR = os.path.join(BASEDIR, 'backup')
#: 日志路径配置
LOG_DIR = os.path.join(BASEDIR, 'log')
#: 数据库设置
SQLALCHEMY_DATABASE_URI = 'mysql://root:zoushj726@127.0.0.1/golsee'
#: 配置缓存
CACHE_TYPE = 'redis'
CACHE_REDIS_URL = 'redis://:@127.0.0.1:6379/2'
CACHE_DEFAULT_TIMEOUT = 60
#: 配置celery
CELERY_BROKER_URL = 'redis://:@127.0.0.1:6379/2'
CELERY_RESULT_BACKEND = 'redis://:@127.0.0.1:6379/2'
#: 每页显示的文章数
ARTICLES_PER_PAGE = 10
#: 随机密码长度
RANDOM_PASSWORD_LENGTH = 5

#: 上传文件配置
UPLOAD_FOLDER = os.path.join(BASEDIR, 'uploads')
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'rar', 'zip', 'tar', 'word', 'xsl', 'xsls'])
MAX_CONTENT_LENGTH = 20 * 1024 * 1024

#: 机器人访问关键字
ROBOT = {'Baiduspider': 'baidu.com',
         'bingbot': 'msn.com',
         'googlebot': 'googlebot.com',
         'AhrefsBot': 'ahrefs.com',
         'Exabot': 'exabot.com'}

#: 恶意访问关键字
ATTACK_VISIT = set(['php'])
